package com.zhl.projectmerger;

import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;

/**
 *
 * @author zhangHL
 */
public interface MergeStrategy {
    /**
     * 判断是否需要合并
     *
     * @param fromClass 来源类描述信息
     * @param toClass   目标类描述信息
     * @param mergerConfig 合并配置
     * @return
     */
    boolean match(ClassOrInterfaceDeclaration fromClass,
                  ClassOrInterfaceDeclaration toClass,
                  ProjectMergeConfig mergerConfig);

    /**
     * import 语句处理
     * @param from
     * @param to
     */
    void importProcess(CompilationUnit from, CompilationUnit to);

    /**
     * 类注解处理
     * @param from
     * @param to
     */
    void classFileAnnotationProcess(ClassOrInterfaceDeclaration from, ClassOrInterfaceDeclaration to);

    /**
     * 字段合并处理
     * @param toClass
     * @param fieldDeclaration
     */
    void fieldsMerge(ClassOrInterfaceDeclaration toClass, FieldDeclaration fieldDeclaration);

    /**
     * 方法合并处理
     * @param toClass
     * @param methodDeclaration
     */
    void methodMerge(ClassOrInterfaceDeclaration toClass, MethodDeclaration methodDeclaration);
}
